package org.hit.burkun.cases.index;

import java.util.Collection;

import org.hit.burkun.db.DBHelper;
import org.hit.burkun.extract.ExtractEntityConfigure;
import org.hit.burkun.extract.FiledsToEntityMapper;
import org.hit.burkun.index.term.ExtractGeneralTerm;
import org.hit.burkun.index.term.IndexTerm;
import org.hit.burkun.index.term.IndexTermDump;

public class TryImportOneTerm {

	public static void main(String[] args) {
		importDB(ExtractEntityConfigure.getDoEntityMapper());
		importDB(ExtractEntityConfigure.getGeneEntityMapper());
		importDB(ExtractEntityConfigure.getGoEntityMapper());
		importDB(ExtractEntityConfigure.getHpEntityMapper());

	}

	public static void importDB(FiledsToEntityMapper mapper) {
		DBHelper termDbh = DBHelper.getLocalBioSearch();
		DBHelper umlsDbh = DBHelper.getServerData();
		ExtractGeneralTerm eterm = new ExtractGeneralTerm(mapper, termDbh,
				umlsDbh);
		Collection<IndexTerm> terms = eterm.getTermSet();
		// import db
		IndexTermDump dump = new IndexTermDump(DBHelper.getLocalBioData(),
				"index_term");
		dump.saveToTable(terms);
	}

}
